Skip to content

Conversation

michael-hawker
Copy link
Member

@michael-hawker michael-hawker commented Oct 16, 2025

Fixes

Adds an example of how to drag/drop settings controls within a list (using drag handle pattern).

Plus Improves Settings Controls examples (minor tweaks)

PR Type

What kind of change does this PR introduce?

  • Sample app changes: Sample

What is the current behavior?

Was hard to understand how this interaction behaved with conflicts of mouse interaction with listview drag and WinUI expander/Button.

What is the new behavior?

Nice sample that explains how to make magic happen. 🦙

DraggableSettingsExpander.mp4

PR Checklist

Please check if your PR fulfills the following requirements:

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • Tested code with current supported SDKs
  • New component
    • Documentation has been added
    • Sample in sample app has been added
    • Analyzers are passing for documentation and samples
    • Icon has been created (if new sample) following the Thumbnail Style Guide and templates
  • Tests for the changes have been added (if applicable)
  • Header has been added to all new source files
  • Contains NO breaking changes

Other information

@niels9001 would love any input on the design here and padding and such.

TODO:

  • Need to try adding a behavior to highlight the drag handle when the mouse is over it.

@michael-hawker michael-hawker added sample app 🖼️ components::controls::settingscontrols Create a Windows 11 style settings experiences with these controls. labels Oct 16, 2025
@michael-hawker
Copy link
Member Author

michael-hawker commented Oct 16, 2025

Hmm, hitting the WebView2Loader issue trying to add the Behaviors dependency on WinUI... not sure why it works for our behaviors component, but not when I add it as a sample dependency to the Settings Samples shared project. @Sergio0694 I know you were planning to update Behaviors to 1.8 which may resolve this as well, eh?

Error Details

1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactions\runtimes\win-x64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactivity\runtimes\win-arm64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactivity\runtimes\win-x64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactivity\runtimes\win-x86\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactions\runtimes\win-arm64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactions\runtimes\win-x86\native\WebView2Loader.dll" because it was not found.
1>Done building project "CommunityToolkit.WinUI.Triggers.csproj".
1>Done building project "CommunityToolkit.WinUI.Controls.SettingsControls.csproj".
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactions\runtimes\win-arm64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactions\runtimes\win-x64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactions\runtimes\win-x86\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactivity\runtimes\win-x86\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactivity\runtimes\win-arm64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5394,5): error MSB3030: Could not copy the file "I:\packages\nuget\microsoft.xaml.behaviors.winui.managed\3.0.0\lib\net8.0-windows10.0.17763.0\Microsoft.Xaml.Interactivity\runtimes\win-x64\native\WebView2Loader.dll" because it was not found.
1>Done building project "SettingsControls.Samples.csproj" -- FAILED.

Edit: I'm hitting this with our base behaviors package locally too, so it's not unique to this scenario for these samples. But it's working for Arlo. He's on an older VS version so he's updating to see if he can repro... weird.

@AndrewKeepCoding
Copy link
Contributor

Just a thought. Might be better to bind SettingsExpander.IsExpanded and ToggleSwitch.IsOn to dedicated properties to avoid confusion.

Recording.2025-10-21.165719.mp4

@michael-hawker
Copy link
Member Author

@AndrewKeepCoding I didn't notice the toggles turning on/off they should maintain their state on drag 🤔. Some folks may use this capability for features that are enabled/disabled and ordered but may also have additional settings, so I don't think everyone will tie IsExpanded to the on toggle (though it's probably a good idea in general, so maybe it makes sense for the sample).

For some reason on my machine I can't build the Behaviors component, so I still can't add the last bit I wanted to this sample.

@michael-hawker
Copy link
Member Author

I've resolved my build issue! 🎉 Seemed like I maybe had a bad prototype/old version of the XAML Behaviors package in my NuGet cache. So I cleared my NuGet cache and hard cleaned my project/repo, and I seem to be back to a working state. 😅

…e of draggable bar with Behavior

Addressed feedback from @AndrewKeepCoding to tie toggle to expander (fixes drag issue losing state)
Add some more notes on usage/behavior

Co-authored-by: Niels Laute <[email protected]>
@michael-hawker michael-hawker marked this pull request as ready for review October 22, 2025 20:02
@michael-hawker
Copy link
Member Author

Alright, this is ready to go! Thanks @AndrewKeepCoding for the feedback, I think I've addressed it with the binding example (now state is not lost on drag, I think the container is just resetting/hydrating on drop and without the ToggleSwitch bound to anything it was sometimes getting reset).

Worked with @niels9001 on the design and alignment. Settings has a custom card example of drag in the Language and Region settings (see the third English card [for when multiple languages]):

image

However, that'd take a lot more work and customization to do, especially for the expander scenario. For a v1 sample this is a bit simpler and more customizable (drag handle could be on right for instance) and works for both controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

components::controls::settingscontrols Create a Windows 11 style settings experiences with these controls. sample app 🖼️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants